<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="js/jquery-1.11.3.js"></script>
  <title>stopPropagation 阻止冒泡</title>
  <style>
    div {
      border: 1px solid red;
    }

    a {
      border: 1px solid green;
      text-decoration: none;
    }
  </style>
</head>

<body>
  <div>
    <a href="javascript:;">click me!</a>
  </div>
  <script>
    $("div").click(function () {
      alert("div");
    });
    $("a").click(function (e) {
      e = e || event;
      //阻止冒泡
      e.stopPropagation();
      console.log(e);
      alert("a");
    });
  </script>
</body>

</html>